var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (i, e) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, i) {
              t.__proto__ = i;
            }) ||
          function (t, i) {
            for (var e in i)
              Object.prototype.hasOwnProperty.call(i, e) && (t[e] = i[e]);
          })(i, e);
      };
      return function (i, e) {
        function s() {
          this.constructor = i;
        }
        if ("function" != typeof e && null !== e)
          throw new TypeError(
            "Class extends value " + String(e) + " is not a constructor or null"
          );
        t(i, e),
          (i.prototype =
            null === e
              ? Object.create(e)
              : ((s.prototype = e.prototype), new s()));
      };
    })(),
  FactionListView = (function (t) {
    function i() {
      var i = t.call(this) || this;
      return (
        i.btn_facList_back.on(
          Laya.Event.CLICK,
          i,
          i.onDidClickFacListBackAction
        ),
        (i.list_fac_shenqing.vScrollBarSkin = ""),
        (i.list_fac_shenqing.selectEnable = !0),
        (i.list_fac_yaoqing.vScrollBarSkin = ""),
        (i.list_fac_yaoqing.selectEnable = !0),
        WebSocketService.addListener({
          caller: i,
          code: 1901,
          method: i.onLoadShenQingListFn,
        }),
        i
      );
    }
    return (
      __extends(i, t),
      (i.showFacListView = function (t) {
        return (
          null == this.facListV && (this.facListV = new i()),
          (this.facListV.fac_type = t),
          (this.facListV.listArr = []),
          (this.facListV.dataSource = []),
          "yaoqing" == t
            ? ((this.facListV.list_fac_shenqing.visible = !1),
              (this.facListV.list_fac_yaoqing.visible = !0))
            : "shenqing" == t &&
              ((this.facListV.list_fac_shenqing.visible = !1),
              (this.facListV.list_fac_yaoqing.visible = !1),
              Global.bangpaiID < 0 ||
                null == Global.bangpaiID ||
                WebSocketService.send({
                  c: 1901,
                  d: { id: Global.bangpaiID, pageNum: 0 },
                })),
          this.facListV
        );
      }),
      (i.prototype.onLoadShenQingListFn = function (t) {
        if (0 == t.code) {
          if (this.currentPage >= 1) {
            if (0 == t.list.length) return void this.currentPage--;
            for (s = 0; s < t.list.length; s++) {
              var i = t.list[s];
              this.listArr.push(i), (this.dataSource = []);
            }
          } else (this.listArr = t.list), (this.dataSource = []);
          (this.isloading = !1),
            this.listArr.length > 0 && (this.list_fac_shenqing.visible = !0);
          for (var e = void 0, s = 0; s < this.listArr.length; s++)
            (e = {
              lavel_shenqing_name: {
                text: this.listArr[s].l + "级" + this.listArr[s].n + "申请加入",
              },
              label_shenqing_result: { text: this.listArr[s].n },
            }),
              this.dataSource.push(e);
          this.list_fac_shenqing.array = this.dataSource;
        }
      }),
      (i.prototype.onLoadMoreHistoryData = function (t) {
        var i = t / this.list_fac_shenqing.scrollBar.max,
          e = new Date(),
          s = !1;
        if (
          (e.getTime() - this.spaceTime >= 3e3 && (s = !0),
          1 == i && 0 == this.isloading && s)
        )
          return (
            (this.isloading = !0),
            this.currentPage++,
            "shenqing" == this.fac_type
              ? WebSocketService.send({ c: 1901, d: { id: 5, pageNum: 0 } })
              : this.fac_type,
            void (this.spaceTime = e.getTime())
          );
      }),
      (i.prototype.onDidClickFacListBackAction = function () {
        this.removeSelf();
      }),
      i
    );
  })(ui.FactionController.FactionListViewUI);
